#ifndef PROGRESS_BAR
#define PROGRESS_BAR

#include <atlbase.h>
#include <atlapp.h>
#include <atlgdi.h>
#include <atlmisc.h>
#include <atlwin.h>
#include <atlcrack.h>

#include "Player.h"
#include "PlayerState.h"
#include <gdiplus.h>
using namespace Gdiplus;
class ProgressBar:public CWindowImpl<ProgressBar, CWindow, CControlWinTraits>
{
public:
    DECLARE_WND_CLASS(_T("REPEATER_WIN"))
    
    BEGIN_MSG_MAP_EX(ProgressBar)
        MSG_WM_PAINT(OnPaint)
        MSG_WM_CREATE(OnCreate)
        MSG_WM_DESTROY(OnDestroy)
    END_MSG_MAP()

    int OnCreate(LPCREATESTRUCT lpCreateStruct);
    void Update(PlayerState& ps);
    void OnPaint(CDCHandle dc);
    LRESULT OnDestroy();
private:
    PlayerState player_state_;
    Rect rect0_, rect1_, rect2_;
    LinearGradientBrush* pbrush_, *repeaterBrush;
private:
    void DrawRectangle(long start, long end, long total, int state);
};
#endif